package com.uhylab.uhuvinetest.activity;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.uhylab.uhuvinetest.R;
import com.uhylab.uhuvinetest.base.UHBaseActivity;

public class UHU2DetailActivity extends UHBaseActivity implements View.OnClickListener {

    private ImageView register_back;
    private ImageView item_img0,item_img1,item_img2,item_img3;
    private TextView item_cotent0,item_cotent1,item_cotent2,item_cotent3;

    private String[] contents = new String[4] ;
    private String[] status = new String[4];
    private String time ;

    @Override
    public int bindLayout() {
        return R.layout.activity_uhu2_detail;
    }

    @Override
    public void initView(View view) {

        register_back = (ImageView) findViewById(R.id.register_back);

        item_img0 = (ImageView) findViewById(R.id.item_img0);
        item_img1 = (ImageView) findViewById(R.id.item_img1);
        item_img2 = (ImageView) findViewById(R.id.item_img2);
        item_img3 = (ImageView) findViewById(R.id.item_img3);

        item_cotent0 = (TextView) findViewById(R.id.item_cotent0);
        item_cotent1 = (TextView) findViewById(R.id.item_cotent1);
        item_cotent2 = (TextView) findViewById(R.id.item_cotent2);
        item_cotent3 = (TextView) findViewById(R.id.item_cotent3);

        register_back.setOnClickListener(this);

        Intent intent = getIntent();
        contents = intent.getStringArrayExtra("contents");
        status = intent.getStringArrayExtra("status");
        time = intent.getStringExtra("time");
        Log.e("TAG",time);
    }

    @Override
    public void doBusiness(Context mContext) {
        if (status[0].equals("0")) {
            item_img0.setImageResource(R.drawable.history_health);
        } else if (status[0].equals("1")) {
            item_img0.setImageResource(R.drawable.history_bad);
        } else if (status[0].equals("2")) {
            item_img0.setImageResource(R.drawable.history_dangerous);
        } else if (status[0].equals("3")) {
            item_img0.setImageResource(R.drawable.history_health1);
        }

        if (status[1].equals("0")) {
            item_img1.setImageResource(R.drawable.history_health);
        } else if (status[1].equals("1")) {
            item_img1.setImageResource(R.drawable.history_bad);
        } else if (status[1].equals("2")) {
            item_img1.setImageResource(R.drawable.history_dangerous);
        } else if (status[1].equals("3")) {
            item_img1.setImageResource(R.drawable.history_health1);
        }

        if (status[2].equals("0")) {
            item_img2.setImageResource(R.drawable.history_health);
        } else if (status[2].equals("1")) {
            item_img2.setImageResource(R.drawable.history_bad);
        } else if (status[2].equals("2")) {
            item_img2.setImageResource(R.drawable.history_dangerous);
        } else if (status[2].equals("3")) {
            item_img2.setImageResource(R.drawable.history_health1);
        }

        if (status[3].equals("0")) {
            item_img3.setImageResource(R.drawable.history_health);
        } else if (status[3].equals("1")) {
            item_img3.setImageResource(R.drawable.history_bad);
        } else if (status[3].equals("2")) {
            item_img3.setImageResource(R.drawable.history_dangerous);
        } else if (status[3].equals("3")) {
            item_img3.setImageResource(R.drawable.history_health1);
        }

        item_cotent0.setText(contents[0]);
        item_cotent1.setText(contents[1]);
        item_cotent2.setText(contents[2]);
        item_cotent3.setText(contents[3]);

    }

    @Override
    public void resume() {

    }

    @Override
    public void destroy() {

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.register_back:
                finish();
                break;
        }
    }
}
